"""
@Time : 2024/6/17 上午11:01
@Auth : AmirKD
@IDE : PyCharm
"""
import tkinter as tk

from GUI import Vo, Login
from api.sparkAPI import content, main
from modules.Add_Project_Info import Info
from modules.Print_Project_Info import Print_Project_Info


class ProjectManagementTool:
    def __init__(self, root):
        self.root = root
        # self.root.geometry("900x400")
        window_width = 600
        window_height = 600
        screen_width = root.winfo_screenwidth()
        screen_height = root.winfo_screenheight()
        x_coordinate = int((screen_width / 2) - (window_width / 2))
        y_coordinate = int((screen_height / 2) - (window_height / 2))
        root.geometry("{}x{}+{}+{}".format(window_width, window_height, x_coordinate, y_coordinate))

        self.root.title("项目管理工具")
        self.main()

    def main(self):
        self.root.place_slaves()

        Button_Add = tk.Button(self.root, text="添 加 项 目 信 息", bg="silver",
                               font=("Microsoft YaHei", 12), command=Vo.vo(self.root).Window_Add, width=20)
        Button_Add.place(x=180, y=170, anchor='nw')
        Button2_Del = tk.Button(self.root, text='删 除 项 目 信 息', bg='silver', font=('Microsoft YaHei', 12),
                                command=Vo.vo(self.root).Window_Del,
                                width=20)
        Button2_Del.place(x=180, y=220, anchor='nw')

        Button3_Mod = tk.Button(self.root, text='修 改 项 目 信 息', bg='silver', font=('Microsoft YaHei', 12),
                                command=Vo.vo(self.root).Window_Mod,
                                width=20)
        Button3_Mod.place(x=180, y=270, anchor='nw')

        Button4_Ser = tk.Button(self.root, text='查 询 项 目 信 息', bg='silver', font=('Microsoft YaHei', 12),
                                command=Vo.vo(self.root).Window_Ser,
                                width=20)
        Button4_Ser.place(x=180, y=320, anchor='nw')

        # Button5_Show = tk.Button(self.root, text='显 示 项 目 信 息', bg='silver', font=('Microsoft YaHei', 12),
        #                          command=lambda: Print_Project_Info(Info), width=20)
        # Button5_Show.place(x=180, y=370, anchor='nw')

        Button5_Show = tk.Button(self.root, text='显 示 项 目 信 息', bg='silver', font=('Microsoft YaHei', 12),
                                 command=Vo.vo(self.root).Window_Show, width=20)
        Button5_Show.place(x=180, y=370, anchor='nw')

        Button6_Show = tk.Button(self.root, text='项 目 精 灵', bg='green', font=('Microsoft YaHei', 12),
                                 command=Vo.vo(self.root).Window_Api, width=20)
        Button6_Show.place(x=180, y=420, anchor='nw')

        Button6_Exit = tk.Button(self.root, text='退 出 管 理 系 统', bg='red', font=('Microsoft YaHei', 12),
                                 command=Vo.vo(self.root).Window_Exit,
                                 width=20)
        Button6_Exit.place(x=180, y=470, anchor='nw')

        result = tk.StringVar()
        result.set(
            "--------------------欢迎使用项目信息管理系统--------------------\n   Edition:  V2.0   \n   @Author:  "
            "AmirKD\nComplete Time:  2024/6/17")
        Show_result = tk.Label(self.root, fg="green", font=("Microsoft YaHei", 12), bd='0', anchor='nw',
                               textvariable=result)
        Show_result.place(x="50", y="50", width="520", height="100")


if __name__ == "__main__":
    # main(
    #     appid="46e9193c",
    #     api_secret="ZTQ3YzM0NGUxMmQwMWRmNjNjMzg0YzIw",
    #     api_key="a6d97c04c658f312cb7e814d8fac8b37",
    #     Spark_url="ws://spark-api.xf-yun.com/v1.1/chat",  # Lite环境的地址
    #     domain="general",  # Lite版本址
    #     query="帮我规划一个项目"
    # )
    # print(content)
    login_root = tk.Tk()
    login_app = Login.LoginWindow(login_root)
    login_root.mainloop()
